<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">

    <body>
        <ui:composition template="./MainTemplate.xhtml">
            <ui:define name="head">
                <script type="text/javascript">
                ( function($) {
                    // Make tab item 'driver' on menu is active
                    $(document).ready( function() { $('#driver').addClass("active"); });
                }) ( jQuery );
                </script>
            </ui:define>

            <ui:define name="title">
                Register Driver
            </ui:define>

            <ui:define name="left">
                <h:form id="form-driver">
                    <h1 class="title">Register Driver</h1>
                    <h4 style="text-align: justify">Website provides listing of drivers from all over VietNam. Company can find the driver according to their need and driver can also be listed here by filling simple registration form below.</h4>
                    <h:panelGrid columns="3" cellpadding="5" id="panel">
                        <h:outputLabel value="Driver's Name:" style="font-weight: bold;"/>
                        <p:inputText id="name" value="#{driverBean.name}" required="true" requiredMessage="Please insert your name!"/>
                        <p:message for="name"/>

                        <h:outputLabel value="Email:" style="font-weight: bold;"/>
                        <p:inputText id="email" value="#{accountBean.email}" required="true" requiredMessage="Please insert your email!"/>
                        <p:message for="email"/>

                        <h:outputLabel value="Password:" style="font-weight: bold;"/>
                        <p:password id="pwd" value="#{accountBean.password}" feedback="true" required="true" requiredMessage="Please insert your password" label="Password"/>
                        <p:message for="pwd"/>

                        <h:outputLabel value="Contact Person:" style="font-weight: bold;"/>
                        <p:inputText id="contact" value="#{driverBean.contactPerson}" required="true" requiredMessage="Please insert contact person!"/>
                        <p:message for="contact"/>

                        <h:outputLabel value="Address:" style="font-weight: bold;"/>
                        <p:inputText id="address" value="#{driverBean.address}" required="true" requiredMessage="Please insert address!"/>
                        <p:message for="address"/>

                        <h:outputLabel value="City" style="font-weight: bold;"/>
                        <p:inputText id="city" value="#{driverBean.city}" required="true" requiredMessage="Please insert city!"/>
                        <p:message for="city"/>

                        <h:outputLabel value="Mobile:" style="font-weight: bold;"/>
                        <p:inputText id="mobile" value="#{driverBean.mobile}" required="true" requiredMessage="Please insert mobile!"/>
                        <p:message for="mobile"/>

                        <h:outputLabel value="Telephone:" style="font-weight: bold;"/>
                        <p:inputText id="telephone" value="#{driverBean.telephone}" required="true" requiredMessage="Please insert telephone"/>
                        <p:message for="telephone"/>

                        <h:outputLabel value="Experience:" style="font-weight: bold;"/>
                        <p:inputText id="experience" value="#{driverBean.experience}" required="true" requiredMessage="Please insert your experiences!"/>
                        <p:message for="experience"/>

                        <h:outputLabel value="Description" style="font-weight: bold;"/>
                        <p:inputTextarea id="description" value="#{driverBean.description}"/>
                        <p:message for="description"/>

                        <h:outputLabel value="Payment Type:" style="font-weight: bold;"/>
                        <h:selectOneMenu id="paymenttype" value="#{paymentBean.paymentType}">
                            <f:selectItem itemValue="Cash" itemLabel="Cash"></f:selectItem>
                            <f:selectItem itemValue="Bank" itemLabel="Bank"></f:selectItem>
                        </h:selectOneMenu>
                        &nbsp;

                        <h:outputLabel value="Extension Day:" style="font-weight: bold;"/>
                        <p:inputText id="amount" value="#{paymentBean.amount}" required="true" requiredMessage="Please insert extension day!"/>
                        <h:selectOneMenu id="extensionday" value="#{paymentBean.extensionType}">
                            <f:selectItem itemValue="Monthly" itemLabel="Monthly"></f:selectItem>
                            <f:selectItem itemValue="Quaterly" itemLabel="Quaterly"></f:selectItem>
                        </h:selectOneMenu>
                        &nbsp;
                    </h:panelGrid>

                    <p:commandButton ajax="false" value="Register" actionListener="#{driversController.processRegister}"/>&nbsp;
                    <p:commandButton value="Reset" type="Reset"/>

                </h:form>
            </ui:define>

            <ui:define name="right">
            </ui:define>

        </ui:composition>

    </body>
</html>
